001    /**
002     * Created by IntelliJ IDEA.
003     * User: Wei Wang
004     * Date: Nov 28, 2002
005     * Time: 2:27:40 AM
006     */
007    
008    package EVolve.visualization.XYViz.ValRefViz.HotSpotViz;
009    
010    import EVolve.data.Element;
011    import EVolve.util.painters.ThreadHotspotPainter;
012    import EVolve.visualization.Dimension;
013    import EVolve.visualization.ValueDimension;
014    import EVolve.visualization.ReferenceDimension;
015    import javax.swing.*;
016    
017    public class ThreadHotspotViz extends HotSpotVisualization{
018    
019        public ThreadHotspotViz() {
020            super();
021            painters[0] = new ThreadHotspotPainter();
022            painters[1] = painters[0];
023        }
024    
025        public Dimension[] createDimension() {
026            Dimension [] returnDimension = new Dimension[3];
027    
028            xAxis = new ValueDimension();
029            yAxis = new ReferenceDimension();
030            zAxis = new ReferenceDimension();
031    
032            returnDimension[0] = xAxis;
033            returnDimension[1] = yAxis;
034            returnDimension[2] = zAxis;
035    
036            return returnDimension;
037        }
038    
039        protected JPanel createConfigurationPanel() {
040            JPanel returnVal = super.createConfigurationPanel();
041    
042            comboPainter.removeItemAt(1);
043    
044            return returnVal;
045        }
046    
047        public void preVisualize() {
048            super.preVisualize();
049            image = null;
050        }
051    
052        public void receiveElement(Element element) {
053            if (element.isOptional()) return;
054    
055            long threadId = zAxis.getField(element);
056    
057            switchThread(threadId);
058    
059            long x = xAxis.getField(element);
060            long y = yAxis.getField(element);
061            long z = 0;
062            phaseDetector.collectData(x/interval,y);
063            paint(x,y,z);
064        }
065    
066        public void visualize() {
067            image = ((ThreadHotspotPainter)painter).getImage();
068            sort();
069        }
070    
071        protected void installPainter() {
072            ((ThreadHotspotPainter)painters[0]).setImageMap(imageMap);
073            super.installPainter();
074        }
075    }